#ifndef ODB_FRIEND_REQUEST_HXX
#define ODB_FRIEND_REQUEST_HXX

#include <boost/date_time/posix_time/posix_time.hpp>
#include <odb/core.hxx>
#include <odb/nullable.hxx>
#include <string>

namespace chat {
#pragma db object table("friend_request")
class FriendRequest {
   public:
    FriendRequest() = default;
    FriendRequest(const std::string& event_id, const std::string& user_id,
                const std::string& peer_id)
        : event_id_(event_id), user_id_(user_id), peer_id_(peer_id) {}

    const std::string& event_id() const { return event_id_; }
    void event_id(const std::string& event_id) { event_id_ = event_id; }

    const std::string& user_id() const { return user_id_; }
    void user_id(const std::string& user_id) { user_id_ = user_id; }

    const std::string& peer_id() const { return peer_id_; }
    void peer_id(const std::string& peer_id) { peer_id_ = peer_id; }

   private:
    friend class odb::access;
#pragma db id auto
    unsigned long id_;
#pragma db type("VARCHAR(64)") index unique
    std::string event_id_;  // 事件id
#pragma db type("VARCHAR(64)") index
    std::string user_id_;  // 用户id(请求者)
#pragma db type("VARCHAR(64)") index
    std::string peer_id_;  // 对端id(响应者)
};
using FriendRequestPtr = std::shared_ptr<FriendRequest>;
}  // namespace chat

#endif  // ODB_FRIEND_REQUEST_HXX
